home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / utils / adt / geo-selfuncs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  3.0 KB  |  136 lines

  1. /***********************************************************************
  2. **
  3. **    geo-selfuncs.c
  4. **
  5. **    Selectivity routines registered in the operator catalog in the
  6. **    "oprrest" and "oprjoin" attributes.
  7. **
  8. **    XXX These are totally bogus.
  9. **
  10. ***********************************************************************/
  11.  
  12. #include "tmp/postgres.h"
  13.  
  14. #include "access/attnum.h"
  15. #include "utils/geo-decls.h"
  16.  
  17. RcsId("$Header: /private/postgres/src/utils/adt/RCS/geo-selfuncs.c,v 1.6 1991/11/09 01:50:59 mer Exp $");
  18.  
  19.  
  20. float64 leftsel ARGS((ObjectId opid , ObjectId relid , AttributeNumber attno , char *value , int32 flag ));
  21. float64 leftjoinsel ARGS((ObjectId opid , ObjectId relid , AttributeNumber attno , char *value , int32 flag ));
  22. float64 contsel ARGS((ObjectId opid , ObjectId relid , AttributeNumber attno , char *value , int32 flag ));
  23. float64 contjoinsel ARGS((ObjectId opid , ObjectId relid , AttributeNumber attno , char *value , int32 flag ));
  24.  
  25. /*ARGSUSED*/
  26. float64
  27. areasel(opid, relid, attno, value, flag)
  28.     ObjectId    opid;
  29.     ObjectId    relid;
  30.     AttributeNumber    attno;
  31.     char        *value;
  32.     int32        flag;
  33. {
  34.     float64    result;
  35.  
  36.     result = (float64) palloc(sizeof(float64data));
  37.     *result = 1.0 / 4.0;
  38.     return(result);
  39. }
  40.  
  41. /*ARGSUSED*/
  42. float64
  43. areajoinsel(opid, relid, attno, value, flag)
  44.     ObjectId    opid;
  45.     ObjectId    relid;
  46.     AttributeNumber    attno;
  47.     char        *value;
  48.     int32        flag;
  49. {
  50.     float64    result;
  51.  
  52.     result = (float64) palloc(sizeof(float64data));
  53.     *result = 1.0 / 4.0;
  54.     return(result);
  55. }
  56.  
  57. /*
  58.  *  Selectivity functions for rtrees.  These are bogus -- unless we know
  59.  *  the actual key distribution in the index, we can't make a good prediction
  60.  *  of the selectivity of these operators.
  61.  *
  62.  *  In general, rtrees need to search multiple subtrees in order to guarantee
  63.  *  that all occurrences of the same key have been found.  Because of this,
  64.  *  the heuristic selectivity functions we return are higher than they would
  65.  *  otherwise be.
  66.  */
  67.  
  68. /*
  69.  *  left_sel -- How likely is a box to be strictly left of (right of, above,
  70.  *        below) a given box?
  71.  */
  72.  
  73. float64
  74. leftsel(opid, relid, attno, value, flag)
  75.     ObjectId    opid;
  76.     ObjectId    relid;
  77.     AttributeNumber    attno;
  78.     char        *value;
  79.     int32        flag;
  80. {
  81.     float64    result;
  82.  
  83.     result = (float64) palloc(sizeof(float64data));
  84.     *result = 1.0 / 6.0;
  85.     return(result);
  86. }
  87.  
  88. float64
  89. leftjoinsel(opid, relid, attno, value, flag)
  90.     ObjectId    opid;
  91.     ObjectId    relid;
  92.     AttributeNumber    attno;
  93.     char        *value;
  94.     int32        flag;
  95. {
  96.     float64    result;
  97.  
  98.     result = (float64) palloc(sizeof(float64data));
  99.     *result = 1.0 / 6.0;
  100.     return(result);
  101. }
  102.  
  103. /*
  104.  *  contsel -- How likely is a box to contain (be contained by) a given box?
  105.  */
  106.  
  107. float64
  108. contsel(opid, relid, attno, value, flag)
  109.     ObjectId    opid;
  110.     ObjectId    relid;
  111.     AttributeNumber    attno;
  112.     char        *value;
  113.     int32        flag;
  114. {
  115.     float64    result;
  116.  
  117.     result = (float64) palloc(sizeof(float64data));
  118.     *result = 1.0 / 10.0;
  119.     return(result);
  120. }
  121.  
  122. float64
  123. contjoinsel(opid, relid, attno, value, flag)
  124.     ObjectId    opid;
  125.     ObjectId    relid;
  126.     AttributeNumber    attno;
  127.     char        *value;
  128.     int32        flag;
  129. {
  130.     float64    result;
  131.  
  132.     result = (float64) palloc(sizeof(float64data));
  133.     *result = 1.0 / 10.0;
  134.     return(result);
  135. }
  136.